package com.xbjtech.mapper;

import com.xbjtech.model.MobileYzm;
import com.xbjtech.model.MobileYzmExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface MobileYzmMapper {
    long countByExample(MobileYzmExample example);

    int deleteByExample(MobileYzmExample example);

    int deleteByPrimaryKey(Long id);

    int insert(MobileYzm record);

    int insertSelective(MobileYzm record);

    List<MobileYzm> selectByExample(MobileYzmExample example);

    MobileYzm selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") MobileYzm record, @Param("example") MobileYzmExample example);

    int updateByExample(@Param("record") MobileYzm record, @Param("example") MobileYzmExample example);

    int updateByPrimaryKeySelective(MobileYzm record);

    int updateByPrimaryKey(MobileYzm record);
    
    /**
	 * 查询2分钟内的未失效的验证码
	 * @param mobile
	 * @return
	 */
	@Select("select id,mobile,yzm,create_time createTime from t_mobile_yzm where mobile=#{mobile} and unix_timestamp(create_time) > (unix_timestamp(current_timestamp()) - 120) order by id desc limit 1")
    MobileYzm selectMobileYzmByMobile(String mobile);
}